package apt.action;

import java.util.List;

import apt.bean.AdvertisingBean;
import apt.dao.AdvertistingDao;

import com.opensymphony.xwork2.ActionSupport;

public class AdvertistingAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private AdvertisingBean advertisingBean;
	private AdvertistingDao advertistingDao;
	private List<AdvertisingBean> listAdvertisingBeans;
	
	public AdvertistingAction() {
		advertistingDao = new AdvertistingDao();
	}
	
	public String initData()
	{
		return SUCCESS;
	}
	
	public static void main(String a[])
	{
		
		AdvertistingAction aa = new AdvertistingAction();
		aa.getListAdvertisting();
		System.out.println(aa.listAdvertisingBeans.get(0).getAdvName());
		
		
		
	}

	public String getListAdvertisting()
	{
		try {
			listAdvertisingBeans = advertistingDao.getAdvertisting();
		} catch (Exception e) {
			return ERROR;
		}
		return SUCCESS;
	}

	public AdvertisingBean getAdvertisingBean() {
		return advertisingBean;
	}

	public void setAdvertisingBean(AdvertisingBean advertisingBean) {
		this.advertisingBean = advertisingBean;
	}

	public AdvertistingDao getAdvertistingDao() {
		return advertistingDao;
	}

	public void setAdvertistingDao(AdvertistingDao advertistingDao) {
		this.advertistingDao = advertistingDao;
	}

	public List<AdvertisingBean> getListAdvertisingBeans() {
		return listAdvertisingBeans;
	}

	public void setListAdvertisingBeans(List<AdvertisingBean> listAdvertisingBeans) {
		this.listAdvertisingBeans = listAdvertisingBeans;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
	
}
